let a:unknown
a='hello'
let x:string
// if(typeof a ==='string'){
//     x=a
// }
// x = a as string

x = <string>a

// let person:{name:string,age?:number}
// let car:{price:number;color:string;[k:string]:any}
// let student:{
//     name:string
//     age:number
// }
interface person{
    name:string
    age:number
    speak():void
}

type person2={
    name:string
    age:number
    speak():void
}

let person:person={
    name:'sfdsdf',
    age:45,
    speak() {
        console.log('shuohua');
        
    },
}

function test<T>(arg:T): T{
    return arg
}
test(10)

function test2():number{//指定返回值的类型，不指定接收的参数
    return 10
}

// 接收一个number类型的a，规定返回值为number类型
function test3(a:number):number{//
    return a
}
test3(10)


function test4<t,k>(a:t,b:k):[t,k]{
    return [a,b]
}
let n = test4<number,string>(10,'hello')
console.log(n);//[10,'hello']

